<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();
require_once '../dao/connectiondao.php';
require_once '../dto/connectiondto.php';
    $memberid = $_SESSION["Name"];
    $friendid = $_REQUEST["idfriend"];
    if($memberid!=NULL&&$friendid!=NULL)
    {
        $con = new connectiondto();
        $con->setMemberID($memberid);
        $con->setConnectedUserID($friendid);
        $con->setIsFriend(true);
        $res = connectiondao::addFriend($con);
//        echo $res;
        if($res)
            header("location:../page/listuser.php");
        else {
            header("location:../page/errorpage.php");
        }
    }  else {
        header("location:../page/errorpage.php");
    }
?>
